package com.jboltai.event.ai.aitext.text2json;

import cn.hutool.core.util.StrUtil;
import com.jboltai.event.CompleteHandler;
import com.jboltai.event.EventType;
import com.jboltai.event.FailHandler;
import com.jboltai.event.SuccessHandler;
import com.jboltai.event.ai.aitext.AITextEvent;
import com.jboltai.event.handler.Text2JsonEventHandler;
import com.jboltai.resource.ai.AIModel;

public class Text2JsonEvent extends AITextEvent<Text2JsonEvent, String, Text2JsonEventHandler>  {
    private static final Double DEFAULT_TEMPERATURE =  0.2;
    public Text2JsonEvent() {
        super(EventType.AI_TEXT_TO_JSON);
        this.setTemperature(DEFAULT_TEMPERATURE);

    }

    public Text2JsonEvent(AIModel model) {
        super(EventType.AI_TEXT_TO_JSON);
        this.aiChatEvent.setModel(model);
        this.setTemperature(DEFAULT_TEMPERATURE);
    }

    /**
     * 创建一个ai事件
     * @param model 使用哪个模型，具体的模型名称根据该枚举值的defaultModel获取
     * @param successHandler
     * @param failHandler
     */
    public Text2JsonEvent(AIModel model, SuccessHandler<Text2JsonEvent, String> successHandler, FailHandler failHandler) {
        super(EventType.AI_TEXT_TO_JSON);
        this.aiChatEvent.setModel(model);
        this.successHandler = successHandler;
        this.failHandler = failHandler;
        this.setTemperature(DEFAULT_TEMPERATURE);
    }
    /**
     * 创建一个ai事件
     * @param model 使用哪个模型，具体的模型名称根据该枚举值的defaultModel获取
     * @param successHandler
     * @param failHandler
     */
    public Text2JsonEvent(AIModel model, SuccessHandler<Text2JsonEvent, String> successHandler, FailHandler failHandler, CompleteHandler completeHandler) {
        super(EventType.AI_TEXT_TO_JSON);
        this.aiChatEvent.setModel(model);
        this.successHandler = successHandler;
        this.failHandler = failHandler;
        this.completeHandler = completeHandler;
        this.setTemperature(DEFAULT_TEMPERATURE);
    }
    private String oriData;

    private String background;

    private String jsonDesc;

    public String getOriData() {
        return this.oriData;
    }

    /**
     * 设置用于提取json的原始数据
     * @param oriData
     * @return
     */
    public Text2JsonEvent oriData(String oriData) {
        this.oriData = oriData;
        return this;
    }
    public String getBackground() {
        return background;
    }

    public Text2JsonEvent background(String background) {
        this.background = background;
        return this;
    }

    public Text2JsonEvent jsonDesc(String jsonDesc) {
        this.jsonDesc = jsonDesc;
        return this;
    }

    public String getJsonDesc() {
        return jsonDesc;
    }




    @Override
    public String preCheck() {

        return null;
    }



}
